import React, { useEffect, useMemo, useState } from 'react'
import dayjs from 'dayjs'
import _ from 'lodash'
import axios from 'axios'

export default function Demo() {
    const [state, setState] = useState()
    useEffect(() => {
        getList()
    }, [])

    const msg = useMemo(() => {
        return _.groupBy(state, (item) => dayjs(item.date).format("YYYY-MM"))
    }, [state])
    console.log(msg);


    async function getList() {
        let res = await axios.get('http://localhost:3001/msg')
        setState(res.data)
    }
    return (
        <div>Demo</div>
    )
}
